<template>
  <el-row class="panel-group" :gutter="40">
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class='card-panel' >
        <div class="card-panel-icon-wrapper icon-people">
          <svg-icon icon-class="peoples" class-name="card-panel-icon" />
          <div class="card-panel-text">用户</div>
        </div>
        <div class="card-panel-description">
          <div class="border-bottom"><span class="border-right">新增</span><span>累计</span></div>
          <div v-if="tongji.user_amount" ><span class="border-right">{{tongji.user_amount.new_user_amount}}</span><span>{{tongji.user_amount.all_user_amount}}</span></div>
        </div>
      </div>
    </el-col>
    <!--<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">-->
      <!--<div class="card-panel" >-->
        <!--<div class="card-panel-icon-wrapper icon-customer">-->
          <!--<svg-icon icon-class="customer" class-name="card-panel-icon" />-->
          <!--<div class="card-panel-text">客户</div>-->
        <!--</div>-->
        <!--<div class="card-panel-description">-->
          <!--<div class="border-bottom"><span class="border-right">消费</span><span>充值</span></div>-->
          <!--<div v-if="tongji.customer_amount" ><span class="border-right">{{tongji.customer_amount.cost_amount}}</span><span>{{tongji.customer_amount.chongzhi_amount}}</span></div>-->
        <!--</div>-->
      <!--</div>-->
    <!--</el-col>-->
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" >
        <div class="card-panel-icon-wrapper icon-morder">
          <svg-icon icon-class="morder" class-name="card-panel-icon" />
          <div class="card-panel-text">订单</div>
        </div>
        <div class="card-panel-description">
          <div class="border-bottom"><span class="border-right">今天</span><span>本月</span></div>
          <div v-if="tongji.morder_amount" ><span class="border-right">{{tongji.morder_amount.today}}</span><span>{{tongji.morder_amount.month}}</span></div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" >
        <div class="card-panel-icon-wrapper icon-agent">
          <svg-icon icon-class="agent" class-name="card-panel-icon" />
          <div class="card-panel-text">分销商</div>
        </div>
        <div class="card-panel-description">
          <div class="border-bottom"><span class="border-right">本月</span><span>累计</span></div>
          <div v-if="tongji.agent_amount" ><span class="border-right">{{tongji.agent_amount.month}}</span><span>{{tongji.agent_amount.all}}</span></div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" >
        <div class="card-panel-icon-wrapper icon-money">
          <svg-icon icon-class="money" class-name="card-panel-icon" />
          <div class="card-panel-text">当日营业</div>
        </div>
        <div class="card-panel-description">
          <div class="border-bottom"><span class="border-right">收入</span><span>支出</span></div>
          <div v-if="tongji.money_total" ><span class="border-right">{{tongji.money_total.in}}</span><span>{{tongji.money_total.out}}</span></div>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
  import CountTo from 'vue-count-to'
  import echarts from 'echarts'
  require('echarts/theme/macarons') // echarts theme
  import Utils from '@/utils/common'
  import DateUtil from '@/utils/dateutil'
  import API from '@/api'
  import Http from '@/http'
  import Store from '@/store'
  import Msg from '@/utils/msg'
  import _ from 'underscore'

  export default {
    data() {
      return {
        tongji:{}
      }
    },
    components: {
      CountTo
    },
    methods: {

    },
    created: function () {
      var that = this
      Http.getModel(API.get_dashboard_tips, {},false).then( (json)=> {
        if(json.code==0) {
          that.tongji = json.data
        }
      })

    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .panel-group {
    margin-top: 18px;
    .card-panel-col{
      margin-bottom: 32px;
    }
    .card-panel {
      height: 108px;
      cursor: pointer;
      font-size: 12px;
      position: relative;
      overflow: hidden;
      color: #666;
      background: #fff;
      box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
      border-color: rgba(0, 0, 0, .05);
      .card-panel-text{
        text-align: center;
      }
      &:hover {
        .card-panel-icon{
          color: #fff;
        }
        .card-panel-text{
          color: #fff;
        }

        .icon-people {
          background: #40c9c6;
        }
        .icon-money {
          background: #d4237a;
        }
        .icon-morder {
          background: #f4516c;
        }
        .icon-agent {
          background: #0b988f
        }
      }
      .icon-people {
        color: #40c9c6;
      }
      .icon-message {
        color: #36a3f7;
      }
      .icon-money {
        color: #d4237a;
      }
      .icon-morder {
        color: #f4516c;
      }
      .icon-agent {
        color: #0b988f;
      }
      .card-panel-icon-wrapper {
        float: left;
        margin: 8px 0 0 8px;
        padding: 16px;
        transition: all 0.38s ease-out;
        border-radius: 6px;
      }
      .card-panel-icon {
        float: left;
        font-size: 48px;
      }
      .card-panel-description {
        float: right;
        font-weight: bold;
        margin: 26px;
        margin-left: 0px;
        div {
          line-height: 18px;
          color: rgba(0, 0, 0, 0.45);
          font-size: 16px;
        }
        .border-bottom{
          border-bottom:1px dashed #aaa
        }
        .border-right{
          border-right:1px dashed #aaa
        }
        span{
          display:inline-block;
          line-height:1.5;
          width:4em;
          text-align:center;
        }
      }
    }
  }
</style>
